agora inbox for [email protected]  
help / color / mirror / Atom feed
Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles)
971+ messages / 5 participants
[nested] [flat]

* Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles)
@ 1998-10-27 23:36 Bruce Momjian <[email protected]>
  1998-10-28 00:11 ` Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) Brook Milligan <[email protected]>
  1998-10-28 02:04 ` Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) The Hermit Hacker <[email protected]>
  0 siblings, 2 replies; 971+ messages in thread

From: Bruce Momjian @ 1998-10-27 23:36 UTC (permalink / raw)
  To: Taral <[email protected]>; +Cc: PostgreSQL-development <[email protected]>

[Charset iso-8859-1 unsupported, filtering to ASCII...]
> > We do insist on gmake.  Can't compile without it.
> 
> Then can we use the gmake 'include' instead of the configure *.in files?
> 
> > Like the term "sed monsters"?
> 
> Yes :)

So you output all defines into a single file, and include that in every
Makefile.  That is interesting.


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  [email protected]            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles)
  1998-10-27 23:36 Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) Bruce Momjian <[email protected]>
@ 1998-10-28 00:11 ` Brook Milligan <[email protected]>
  1998-10-29 06:26   ` Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) Billy G. Allie <[email protected]>
  1 sibling, 1 reply; 971+ messages in thread

From: Brook Milligan @ 1998-10-28 00:11 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]; [email protected]

   So you output all defines into a single file, and include that in every
   Makefile.  That is interesting.

I guess this isn't too clear.  Here is what I am trying to advocate:

configure output -> Makefile.global + config.h substituting as
appropriate.

all Makefiles include Makefile.global (which includes Makefile.custom
if it exists? and other things like the shared library Makefile).

one of the included Makefiles has a generic rule for *.sql.in -> *.sql
that depends on Makefile.global also.

If a directory has *.sql.in it will automatically be converted with
the correct substitutions; after all, the substitution is the same in
each case so one rule suffices (even if several variables need
substituting); note that sed will not substitute for patterns not
found in individual *.sql.in files even if the general rule says
otherwise.

Same mechanism for any other general substitutions, if necessary
(probably not).

Makefiles do not have any sed monsters, just one rule involving sed in
a generally included Makefile.sed_monsters. :)  The individual
*.sql.in files would be written in exactly the same way as if
configure was doing the substitution.

All configure information is in one place (Makefile.global and
config.h).  All dependencies do the right thing, even if those are
changed post-configure.

Cheers,
Brook



^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles)
  1998-10-27 23:36 Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) Bruce Momjian <[email protected]>
  1998-10-28 00:11 ` Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) Brook Milligan <[email protected]>
@ 1998-10-29 06:26   ` Billy G. Allie <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Billy G. Allie @ 1998-10-29 06:26 UTC (permalink / raw)
  To: Brook Milligan <[email protected]>; +Cc: [email protected]; [email protected]; [email protected]

Brook Milligan wrote:
>    So you output all defines into a single file, and include that in every
>    Makefile.  That is interesting.
> 
> I guess this isn't too clear.  Here is what I am trying to advocate:
> 
> configure output -> Makefile.global + config.h substituting as
> appropriate.
> 
> all Makefiles include Makefile.global (which includes Makefile.custom
> if it exists? and other things like the shared library Makefile).
> 
> one of the included Makefiles has a generic rule for *.sql.in -> *.sql
> that depends on Makefile.global also.
> 
> If a directory has *.sql.in it will automatically be converted with
> the correct substitutions; after all, the substitution is the same in
> each case so one rule suffices (even if several variables need
> substituting); note that sed will not substitute for patterns not
> found in individual *.sql.in files even if the general rule says
> otherwise.
> 
> Same mechanism for any other general substitutions, if necessary
> (probably not).
> 
> Makefiles do not have any sed monsters, just one rule involving sed in
> a generally included Makefile.sed_monsters. :)  The individual
> *.sql.in files would be written in exactly the same way as if
> configure was doing the substitution.
> 
> All configure information is in one place (Makefile.global and
> config.h).  All dependencies do the right thing, even if those are
> changed post-configure.
> 
> Cheers,
> Brook
> 

This would seem to work, although we would at least need a rule for *.sh.in -> 
*.sh for the mkMakefile.[tcl|tk]defs.sh files needed for TCL/TK support.

I still have a problem with editing files to curcumvent configure.  But I 
could live with a solution as outlined above.  I don't have to edit the 
makefiles and if someone else wants to, well they roll the die and take their 
chances :-)

-- 
____       | Billy G. Allie    | Domain....: [email protected]
|  /|      | 7436 Hartwell     | Compuserve: 76337,2061
|-/-|----- | Dearborn, MI 48126| MSN.......: [email protected]
|/  |LLIE  | (313) 582-1540    | 





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles)
  1998-10-27 23:36 Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) Bruce Momjian <[email protected]>
@ 1998-10-28 02:04 ` The Hermit Hacker <[email protected]>
  1998-10-28 02:23   ` Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) Bruce Momjian <[email protected]>
  1 sibling, 1 reply; 971+ messages in thread

From: The Hermit Hacker @ 1998-10-28 02:04 UTC (permalink / raw)
  To: Bruce Momjian <[email protected]>; +Cc: Taral <[email protected]>; PostgreSQL-development <[email protected]>

On Tue, 27 Oct 1998, Bruce Momjian wrote:

> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > > We do insist on gmake.  Can't compile without it.
> > 
> > Then can we use the gmake 'include' instead of the configure *.in files?
> > 
> > > Like the term "sed monsters"?
> > 
> > Yes :)
> 
> So you output all defines into a single file, and include that in every
> Makefile.  That is interesting.

	Technically, we are doing that now with Makefile.global ... its
included in every Makefile in the system, and has CFLAGS and such defined
in it.  It wouldn't be unreasonable to have a MISSING_OBJ= put into
Makefile.global, and remove the Makefile.in in the backend/ports
directory... *shrug*

Marc G. Fournier                                
Systems Administrator @ hub.org 
primary: [email protected]           secondary: scrappy@{freebsd|postgresql}.org 




^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles)
  1998-10-27 23:36 Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) Bruce Momjian <[email protected]>
  1998-10-28 02:04 ` Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) The Hermit Hacker <[email protected]>
@ 1998-10-28 02:23   ` Bruce Momjian <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Bruce Momjian @ 1998-10-28 02:23 UTC (permalink / raw)
  To: The Hermit Hacker <[email protected]>; +Cc: [email protected]; [email protected]

> 	Technically, we are doing that now with Makefile.global ... its
> included in every Makefile in the system, and has CFLAGS and such defined
> in it.  It wouldn't be unreasonable to have a MISSING_OBJ= put into
> Makefile.global, and remove the Makefile.in in the backend/ports
> directory... *shrug*

Yes.  I think that kind of thing would make sense, and would allow
Makefile.custom to over-rule it, though that is more of an affect rather
than a feature I would promote.  configure flags should do most of the
work.


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  [email protected]            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread

* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 971+ messages in thread

From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)

These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is
ensured to run with high enough wal_level.

Discussion: https://postgr.es/m/[email protected]
---
 contrib/test_decoding/Makefile            |  2 +-
 contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
 contrib/test_decoding/meson.build         |  1 +
 contrib/test_decoding/sql/repack.sql      | 25 +++++++++++++++++++
 src/test/regress/expected/cluster.out     | 29 +++-------------------
 src/test/regress/sql/cluster.sql          | 13 +++-------
 6 files changed, 65 insertions(+), 35 deletions(-)
 create mode 100644 contrib/test_decoding/expected/repack.out
 create mode 100644 contrib/test_decoding/sql/repack.sql

diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
 
 REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
 	decoding_into_rel binary prepared replorigin time messages \
-	spill slot truncate stream stats twophase twophase_stream
+	repack spill slot truncate stream stats twophase twophase_stream
 ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
 	oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
 	twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+  relname  | ?column? 
+-----------+----------
+ ptnowner  | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
       'replorigin',
       'time',
       'messages',
+      'repack',
       'spill',
       'slot',
       'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+  SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+  JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 ERROR:  permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
 WARNING:  permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR:  cannot process relation "ptnowner1"
-HINT:  Relation "ptnowner1" has no identity index.
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-  relname  | ?column? 
------------+----------
- ptnowner  | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 -- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
 -- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
 ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
 ALTER TABLE ptnowner OWNER TO regress_ptnowner;
 CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
   JOIN pg_class AS c ON c.oid=tree.relid;
 SET SESSION AUTHORIZATION regress_ptnowner;
 CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
 RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
-  JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
 DROP TABLE ptnowner;
 DROP ROLE regress_ptnowner;
 
@@ -346,6 +337,10 @@ COMMIT;
 --
 -- REPACK
 --
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
 ----------------------------------------------------------------------
 
 -- REPACK handles individual tables identically to CLUSTER, but it's worth
-- 
2.47.3


--5vljmhsecqh6fok5--





^ permalink  raw  reply  [nested|flat] 971+ messages in thread


end of thread, other threads:[~2026-04-22 09:22 UTC | newest]

Thread overview: 971+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-10-27 23:36 Re: [HACKERS] Configure problem, redux (was Re: TCL installation troubles) Bruce Momjian <[email protected]>
1998-10-28 00:11 ` Brook Milligan <[email protected]>
1998-10-29 06:26   ` Billy G. Allie <[email protected]>
1998-10-28 02:04 ` The Hermit Hacker <[email protected]>
1998-10-28 02:23   ` Bruce Momjian <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox